home *** CD-ROM | disk | FTP | other *** search
- Path: unsw.edu.au!gwong
- From: gwong@cse.unsw.edu.au (Geoffrey Wong)
- Newsgroups: comp.lang.c
- Subject: QUESTION about pointers and structures
- Date: 11 Jan 1996 02:14:40 GMT
- Organization: University of New South Wales
- Message-ID: <4d1rqg$bse@mirv.unsw.edu.au>
- NNTP-Posting-Host: thesis.circus.cse.unsw.edu.au
- X-Newsreader: TIN [version 1.2 PL2]
-
- Hi guys,
- I am wondering if anyone of you c legends could help me. I have a
- rather complex data structure.
- It is a pointer to structure which contains pointer to structures.
- I don't know if I need to allocate space for variables of this complex
- type before I can do the assignments.
-
- I have a variable called background.
- declared as:-
- SLiteral *background;
-
- Now SLiteral is:-
-
- typedef struct _slit_rec *SLiteral, /* Used in rlgg */
-
-
- and _slit_rec is:-
-
- struct _slit_rec
-
- {
-
- char Sign; /* 0=negated, 1=pos, 2=determinate */
-
- Relation Rel;
-
- Const *Constants; /* During an rlgg process Constant and Var is
-
- coded using the same data type. This is
-
- possible since Const is larger than Var! */
-
- Which *ConstVar; /* 0=const, 1=Var for each Constants */
-
- int WeakLits; /* value up to this literal */
-
- Ordering *ArgOrders, /* recursive lits: =, <, >, # */
-
- *SaveArgOrders; /* copy during pruning */
-
- float Bits; /* encoding length */
-
- };
-
-
-
-
- Now my question is can I just say background[i]->Sign = ???? or do I need to
-
- allocate space for background[i] or do I need to allocate space for *background
-
-
-
- Any help would be appreciated, I am rather new to c, don't know much tricks
-
- yet.
-
-
-
- geoff.
-
-
-